<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/css/BuyerOrder.css">
    <title>买家订单</title>
</head>
<body>
<div>
    <ul id="s">
        <li><a href=""> 选桌 </a></li>
        <li><a href=""> 下单 </a></li>
        <li><a href="/buyer/order"> >订单 </a></li>
    </ul>
</div>

<div id="buyerOrder2">
    <table id="buyerOrder">
        <tr>
            <th colspan="5">我的订单</th>
        </tr>
        <tr>
            <th id="first">图片</th><th>菜品id</th><th>菜品名称</th><th>价格</th><th>数量</th>
        </tr>
        <tr th:each="shoppingorder : ${orderHtml}"> <!--Thymeleaf-->
            <td><img th:src="@{${dishurl}+${shoppingorder.foodID}+'.jpg'}" onerror="this.src='../images/Mysterious.jpg';this.onerror=null;"></td>
            <td th:text="${shoppingorder.foodID}"></td>
            <td th:text="${shoppingorder.foodname}"></td>
            <td th:text="${shoppingorder.foodprice}"></td>
            <td th:text="${shoppingorder.foodnumber}"></td>
            <div th:with="x=${x}+${shoppingorder.foodprice}"></div>
        </tr>
        <tr>
            <td colspan="3">总价</td>
            <td>[[${#numbers.formatDecimal(   #aggregates.sum(orderHtml.![foodprice == null ? 0:foodprice*foodnumber])  ,1,'COMMA',2,'POINT')}]] </td>
            <td>[[${#aggregates.sum(orderHtml.![foodnumber == null ? 0:foodnumber])}]]</td>
        </tr>
    </table>
</div>

<div id="buyerOrder4">
    <table id="buyerOrder3">
        <tr>
            <td>餐桌:</td>
        </tr>
        <tr th:each="shoppingorder : ${orderHtml2}"> <!--Thymeleaf-->
            <td th:text="${shoppingorder.tablenumber}"></td>
        </tr>
        <tr>
            <td>订单时间:</td>
        </tr>
        <tr th:each="shoppingorder : ${orderHtml2}"> <!--Thymeleaf-->
            <td th:text="${shoppingorder.ordertime}"></td>
        </tr>
    </table>
</div>
<div id = "order">
<a th:each="shoppingorder : ${orderHtml2}" th:href="@{'/table/nouse/' +${shoppingorder.tablenumber}}"><button>付款离开</button></a>
</div>
</body>
</html>